cmake_minimum_required(VERSION 2.8)

project(openav)

include_directories(${OPENCV_ROOT}/include)
link_directories(${OPENCV_ROOT}/lib)

set(COMMON_LIBRARIES
        opencv_imgproc
        opencv_imgcodecs
        opencv_core
        opencv_videoio
        opencv_video
        opencv_highgui
        opencv_objdetect
        opencv_features2d
        opencv_flann
        opencv_calib3d
        opencv_stitching)


set(OAVBASE_FILES
        ../common/config/CMConfigGeneral.cpp
        ../common/config/CMConfigGeneral.h
        ../common/config/CMConfigCpp.h
        ../common/config/CMConfigCpp.cpp
        ../common/utils/cm_print.c
        ../common/utils/cm_print.h
        OAVBase.cpp
        OAVBase.h OAVImgOptsSimple.cpp OAVImgOptsSimple.h)

foreach(arg ${COMMON_EX_JSON_FILES})
    list(APPEND OAVBASE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../${arg}")
endforeach()

add_executable(cm_oav_app
        cm_oav_app.cpp
        ${OAVBASE_FILES}
        )

target_link_libraries(cm_oav_app
        ${COMMON_LIBRARIES})

add_executable(cmstitch
        stitching.cpp
        ../codec/cmyuv.c
        )

target_link_libraries(cmstitch
        ${COMMON_LIBRARIES}
        )

add_executable(catch_img
        catch_imgs.cpp
        ../codec/cmyuv.c
        )

target_link_libraries(catch_img
        opencv_imgproc
        opencv_imgcodecs
        opencv_core
        )

add_executable(catch_frame
        catch_frame.cpp)
target_link_libraries(catch_frame
        opencv_imgproc
        opencv_imgcodecs
        opencv_core
        opencv_videoio
        )

add_executable(facedetect
        face_detect.cpp
        DrawSomething.cpp
        BaseOperation.cpp
        CVFaceDetect.cpp
        )
target_link_libraries(facedetect
        ${COMMON_LIBRARIES}
        )

add_executable(cm_image_quality_test
        cm_image_quality_test.cpp
        cm_image_quality.cpp
        cm_image_quality.h
        ../common/funcs/CMCommandLineParser.cpp
        ../common/funcs/CMCommandLineParser.h
        )

target_link_libraries(cm_image_quality_test
        ${COMMON_LIBRARIES})